<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">

		<h:form id="editionSearch" styleClass="edit">

			<rich:simpleTogglePanel label="Edition search parameters"
				switchType="ajax">
				<s:decorate template="layout/display.xhtml">
					<ui:define name="label">name</ui:define>
					<h:inputText id="name" value="#{editionList.edition.name}" />
				</s:decorate>
			</rich:simpleTogglePanel>

			<div class="actionButtons"><h:commandButton id="search"
				value="Search" action="/EditionList.xhtml" /></div>

		</h:form>
		<h:form>
			<rich:panel>
				<f:facet name="header">Edition search results</f:facet>
				<div class="results" id="editionList"><h:outputText
					value="No editions found"
					rendered="#{empty editionList.resultList}" /></div>
				<rich:dataTable value="#{editionList.resultList}" var="edition">

					<h:column>
						<f:facet name="header">Edition</f:facet>
            			#{edition.name}
        			</h:column>
					<h:column>
						<f:facet name="header">Block</f:facet>
            			#{edition.blockName}
        			</h:column>
					<h:column>
						<f:facet name="header">Release-date</f:facet>
						<h:outputText value="#{edition.releaseDate}">
							<s:convertDateTime type="both" pattern="dd-MM-yyyy" />
						</h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">Print-size</f:facet>
            			#{edition.printSize}
        			</h:column>
					<h:column>
						<f:facet name="header">Symbol</f:facet>
						<s:link view="/#{empty from ? 'Edition' : from}.xhtml"
							id="editionExpansionSymbol" styleClass="expansionSymbolLink">
							<f:param name="editionId" value="#{edition.id}" />
							<s:graphicImage value="#{edition.expansionSymbol}" rendered="#{!empty edition.expansionSymbol}" />
						</s:link>
					</h:column>
					<h:column>
						<f:facet name="header">Action</f:facet>
						<s:button view="/#{empty from ? 'Edition' : from}.xhtml"
							value="Select" id="edition">
							<f:param name="editionId" value="#{edition.id}" />
						</s:button>
					</h:column>
					<f:facet name="footer">
						<rich:datascroller></rich:datascroller>
					</f:facet>
				</rich:dataTable>
			</rich:panel>
		</h:form>
		<s:div styleClass="actionButtons" rendered="#{empty from}">
			<s:button view="/EditionEdit.xhtml" id="create"
				value="Create edition">
				<f:param name="editionId" />
			</s:button>
		</s:div>

	</ui:define>

</ui:composition>

